<!DOCTYPE html>
<html>
    <head><title>订单列表</title>
        <style type="text/css">
            body{
                font-size:14px;
            }
            td,tr,th{
                border:1px solid;
                border-color:#ccc;
            }
            th,td{
                padding-top: 5px;
                padding-bottom:5px;
            }
            table{
                width: 100%;
                border: 1px solid;
                border-collapse: collapse;
            }
            .c {
                text-align: center;
            }
        </style>
    </head>
    <body>
        <div>
            <div>
        订单状态:
        <a href="{{ 
            url_for('.order_list', type='WAIT_SELLER_SEND_GOODS')
            }}"><button>待发货</button></a>
        <a href="{{ 
            url_for('.order_list', type='WAIT_BUYER_PAY')
            }}"><button>待付款</button></a>
        <a href="{{ 
            url_for('.order_list', type='WAIT_BUYER_CONFIRM_GOODS')
            }}"><button>待确认收货</button></a>
        <a href="{{ 
            url_for('.order_list', type='WAIT_SELLER_AGREE')
            }}"><button>待退款</button></a>
        <a href="{{ 
            url_for('.order_list', type='REFUND_SUCCESS')
            }}"><button>已退款</button></a>
        <a href="{{ 
            url_for('.order_list', type='TRADE_FINISHED')
            }}"><button>交易成功</button></a>
        <a href="{{ 
            url_for('.order_list', type='TRADE_CLOSED')
            }}"><button>已关闭</button></a>
        <a href="{{
            url_for('.order_list', type='all')
            }}"><button>全部</button></a>
    </div>
        <div style="float: right">
            <form action="{{
                url_for('.order_list')
                }}" method="GET" id="f">
                <label for="f">请输入关键字:</label>
                <input type="text" name="key" value="">
                <input type="submit" value="搜索">
            </form>
        </div>
    </div>
        <div style="height: 10px; clear: both"></div>
        <table id="order">
            <tr>
                <th>交易号</th><th>商品名</th><th>数量</th>
                <th>付款时间</th><th>总金额</th><th>收货人信息</th>
                <th>物流信息</th><th>状态</th><th>操作</th>
            </tr>
            {% for trade_no,trade_status,receive_name,receive_address,
                receive_zip,receive_phone,receive_mobile,gmt_payment,
                subject,quantity,total_fee, trade_name, invoice_no,refund_status
                in items
                %}
            <tr>
                <td class="c">{{ trade_no }}</td>
                <td class="c">{{ subject }}</td>
                <td class="c">{{ quantity }}</td>
                <td class="">
                    {% if gmt_payment %}
                        {{ gmt_payment }}
                    {% endif %}
                </td>
                <td class="c">{{ total_fee }}</td>
                <td>
                    {{ receive_name }}, {{ receive_zip }}, {{ receive_address }},
                    {{ receive_phone }}, {{ receive_mobile }}
                </td>
                <td>{% if trade_name %}
                    <div>{{ trade_name }}</div>
                    {% endif %}
                    {% if invoice_no %}
                    <div>{{ invoice_no }}</div>
                    {% endif %}
                </td>
                <td>
                    {% if refund_status %}
                    {{ TS[refund_status] }}
                    {% else %}
                    {{ TS[trade_status] }}
                    {% endif %}
                </td>
                <td class="c"> 
                    {% if trade_status == 'WAIT_SELLER_SEND_GOODS' %}
                    <a href="{{ url_for('alipay.send_goods', trade_no = trade_no) }}"><button>确认发货</button></a>
                    {% endif %}
                </td>
            </tr>
                {% endfor %}

        </table>
        <div style="height: 20px"></div>
        <div>
            <a href="{{
                url_for('.order_list', start = 0, type = t)
                }}">首页</a> <a href="{{
                url_for('.order_list', start = next, type = t)
                }}">下一页</a>
        </div>
    </body>
</html>
